public class Test3 {
    public static void main(String[] args) {
        Node<String> C = new Node<>("C", null);
        Node<String> B = new Node<>("B", C);
        Node<String> A = new Node<>("A", B);

        Node<String> head = A;

        //头插入

        /*Node<String> M = new Node<String>("M", null);
        M.next=A;
        head=M;*/
        head=new Node<String>("M",A);

        //中间/尾插入

        /*Node<String> Q = new Node<>("Q",null);
        Q.next=A.next;
        A.next=Q;*/
        A.next=new Node<>("Q",A.next);

        C.next=new Node<>("Z",C.next);

        //头删除
        head=head.next;

        //中间删除
        A.next=A.next.next;
        C.next=C.next.next;


        Node<String> p=head;
        while (p!=null){
            System.out.print(p.data);
            p=p.next;
        }

    }
}
